package com.huike.web.controller.report;


import com.huike.common.core.domain.AjaxResult;
import com.huike.report.domain.dto.IndexDto;
import com.huike.report.domain.vo.IndexChangeVo;
import com.huike.report.domain.vo.IndexVo;
import com.huike.report.service.IReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/index")
@Slf4j
public class IndexController {
    @Autowired
    private IReportService iReportService;

    @GetMapping
    public AjaxResult index(IndexDto indexDto){
        log.info("首页数据统计 {}", indexDto);
        IndexVo indexVo = iReportService.index(indexDto);

        return AjaxResult.success(indexVo);
    }

    @GetMapping("/salesStatistic")
    public AjaxResult indexClues(IndexDto indexDto){
        log.info("线索转化龙虎榜单 {}", indexDto);
        List<IndexChangeVo> list = iReportService.indexClues(indexDto);

        return AjaxResult.success(list);
    }

    @GetMapping("/businessChangeStatistics")
    public AjaxResult indexBusiness(IndexDto indexDto){
        log.info("商机转化龙虎榜单 {}", indexDto);
        List<IndexChangeVo> list = iReportService.indexBusiness(indexDto);

        return AjaxResult.success(list);
    }

}